package loginuser

import "time"

/**
 * 用户表'LoginUser'表结构体
 * 警告:非数据库字段禁止在此添加,应该创建扩展结构体中添加
 * @author HuangXinBian
 */
type LoginUser struct {
	GsId           string    `json:"sId" gorm:"column:sId; type:varchar(8); NOT NULL; primary_key; comment:表编号"`
	GsName         string    `json:"sName" gorm:"column:sName; type:varchar(32); NOT NULL; comment:名称"`
	GsNo           string    `json:"sNo" gorm:"column:sNo; type:varchar(64); NOT NULL; comment:标识(组合唯一)"`
	GsPass         string    `json:"sPass" gorm:"column:sPass; type:varchar(64); NOT NULL; comment:密码"`
	GsType         string    `json:"sType" gorm:"column:sType; type:varchar(50); NOT NULL; DEFAULT:管理员; comment:类型"`
	GsPassWork     string    `json:"sPassWork" gorm:"column:sPassWork; type:varchar(64); comment:业务密码"`
	GsOwner        string    `json:"sOwner" gorm:"column:sOwner; type:varchar(100); DEFAULT:BaseSystem.LoginUser; comment:来源"`
	GsAttrib       string    `json:"sAttrib" gorm:"column:sAttrib; type:longtext; comment:附属信息"`
	GsMemo         string    `json:"sMemo" gorm:"column:sMemo; type:varchar(200); comment:备注"`
	GsCreator      string    `json:"sCreator" gorm:"column:sCreator; type:varchar(8); NOT NULL; DEFAULT:00000000; comment:创建人员"`
	GdCreateDate   time.Time `json:"dCreateDate" gorm:"column:dCreateDate; type:datetime; NOT NULL; comment:创建时间"`
	GsModifieder   string    `json:"sModifieder" gorm:"column:sModifieder; type:varchar(8); NOT NULL; DEFAULT:00000000; comment:修改人员"`
	GdModifiedDate time.Time `json:"dModifiedDate" gorm:"column:dModifiedDate; type:datetime; NOT NULL; comment:修改时间"`
	GiState        int       `json:"iState" gorm:"column:iState; type:int(8); NOT NULL; DEFAULT:1; comment:状态(枚举,1:启用;2:禁用)"`
	GiIndex        int       `json:"iIndex" gorm:"column:iIndex; type:int(8); NOT NULL; DEFAULT:1; comment:序号"`
	GiVersion      int       `json:"iVersion" gorm:"column:iVersion; type:int(8); NOT NULL; DEFAULT:1; comment:版本号"`
}

/**
 * 初始化
 */
func init() {
}

/**
 * 创建结构实体,并赋予默认值
 */
func (LoginUser) New() LoginUser {
	return LoginUser{
		GsId:           "",
		GsName:         "",
		GsNo:           "",
		GsPass:         "",
		GsType:         "管理员",
		GsPassWork:     "",
		GsOwner:        "BaseSystem.LoginUser",
		GsAttrib:       "",
		GsMemo:         "",
		GsCreator:      "00000000",
		GdCreateDate:   time.Now(),
		GsModifieder:   "00000000",
		GdModifiedDate: time.Now(),
		GiState:        1,
		GiIndex:        1,
		GiVersion:      1,
	}
}

/**
 * 设置默认值
 */
func (o *LoginUser) SetDefault() {
	o.GsId = ""
	o.GsName = ""
	o.GsNo = ""
	o.GsPass = ""
	o.GsType = "管理员"
	o.GsPassWork = ""
	o.GsOwner = "BaseSystem.LoginUser"
	o.GsAttrib = ""
	o.GsMemo = ""
	o.GsCreator = "00000000"
	o.GdCreateDate = time.Now()
	o.GsModifieder = "00000000"
	o.GdModifiedDate = time.Now()
	o.GiState = 1
	o.GiIndex = 1
	o.GiVersion = 1
}

/**
 * 结构体映射表名,处理结构体名称与表名不一致的情况
 */
func (LoginUser) TableName() string {
	return "LoginUser"
}
